package com.budwk.app.sqfwV2.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 特殊老年人探访
 */
@Getter
public enum OldPeopleSeekEnum {
    CARE_SERVICE_RECORD_PDF("1", "特殊老年人探访", "特殊老年人探访",
            "特殊困难老年人探访关爱服务记录表", "【特殊困难老年人探访关爱服务记录表】合集",
            "特殊困难老年人探访关爱服务记录表模板", "pdf", "/preview/lnrtf/visit_record_pdf.png"),
    CARE_SERVICE_RECORD_EXCEL("2", "特殊困难老年人探访", "特殊老年人探访",
            "特殊困难老年人探访台账", "【特殊困难老年人探访】台账",
            "特殊困难老年人探访模板", "excel", "/preview/lnrtf/visit_record_excel.png"),
    ;

    private String code;
    private String name;
    private String type;
    private String oneName;
    private String compilationName;
    private String templateName;
    private String fileType;
    private String img;

    OldPeopleSeekEnum(String code, String name, String type, String oneName, String compilationName, String templateName, String fileType, String img) {
        this.name = name;
        this.code = code;
        this.type = type;
        this.oneName = oneName;
        this.compilationName = compilationName;
        this.templateName = templateName;
        this.fileType = fileType;
        this.img = img;
    }

    public static String getName(String code) {
        for (OldPeopleSeekEnum o : OldPeopleSeekEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getName();
            }
        }
        return null;
    }

    public static String getOneName(String code) {
        for (OldPeopleSeekEnum o : OldPeopleSeekEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getOneName();
            }
        }
        return null;
    }

    public static String getCompilationName(String code) {
        for (OldPeopleSeekEnum o : OldPeopleSeekEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getCompilationName();
            }
        }
        return null;
    }

    public static String getTemplateName(String code) {
        for (OldPeopleSeekEnum o : OldPeopleSeekEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getTemplateName();
            }
        }
        return null;
    }

    public static OldPeopleSeekEnum getEnum(String code) {
        for (OldPeopleSeekEnum o : OldPeopleSeekEnum.values()) {
            if (o.getCode().equals(code)) {
                return o;
            }
        }
        return null;
    }

    public static List<OldPeopleSeekEnum> getPdf() {
        List<OldPeopleSeekEnum> list = new ArrayList<>();
        for (OldPeopleSeekEnum o : OldPeopleSeekEnum.values()) {
            if (o.getFileType().equals("pdf")) {
                list.add(o);
            }
        }
        return list;
    }

    public static List<OldPeopleSeekEnum> getExcel() {
        List<OldPeopleSeekEnum> list = new ArrayList<>();
        for (OldPeopleSeekEnum o : OldPeopleSeekEnum.values()) {
            if (o.getFileType().equals("excel")) {
                list.add(o);
            }
        }
        return list;
    }
}
